<?php
global $base_url;
if (count($data) == 0)
    return;
?>
<?php foreach ($data as $category) : ?>
    <?php $counter = 0; ?>
    <section id="category_<?php echo $category['tid'] ?>" class="products_showcase left">
        <div class="product_showcase_heading">
            <h2><?php echo $category['name']; ?></h2>
            <a href="<?php echo url('taxonomy/term/' . $category['tid']); ?>">see more...</a>
        </div><!--end product_showcase_heading-->
        <ul>
            <?php
            if (count($category['nodes'] != 0)):
                foreach ($category['nodes'] as $model):
                    ?>
                    <li>
                        <a href="<?php echo url('node/' . $model['product']['nid']); ?>">
                            <img alt="<?php echo $model['product']['title'] ?>" src="<?php echo $base_url . '/' . $model['product']['filepath'] ?>">
                        </a>
                        <h4><?php echo $model['product']['title'] ?></h4>
                        <?php foreach ($model['issues'] as $nid => $issue) : ?>
                            <h4><a href="<?php echo url('node/' . $nid); ?>"><?php echo $issue['num'] . ' issues - $' . $issue['price'] ?></a></h4>
                        <?php endforeach ?>
                    </li>
                    <?php $counter++; ?>
                    <?php if ($counter % 4 == 0): ?>
                        <?php
                        $counter = 0;
                        print "<br class='clear' />";
                        ?>
                    <?php endif; ?>
                    <?php
                endforeach;
            endif;
            ?>
            <div class="clear"></div>
        </ul>
    </section><!--end science_nature_teaser-->
<?php endforeach; ?>